package org.zezs.deployment.config;

import org.zezs.deployment.Deploy;

public class TomcatNode extends Node {

    @Override
    public String getFilePath() {
        return this.getHomePath() + "/webapps/" + this.getName();
    }

    @Override
    public String getShellId() {
        return Deploy.exeCmd("ps -ef |grep '"+this.getHomePath()+"' |grep 'classpath'|grep -v 'grep'|awk '{print $2}'",this.getSession());
    }

    @Override
    public void clear() {
        Deploy.exeCmd("rm -rf " + this.getHomePath() + "/work/*",this.getSession());
        Deploy.exeCmd("rm -rf " + this.getHomePath() + "/webapps/*",this.getSession());
    }

    @Override
    public void star() {
        Deploy.exeCmd("source /etc/profile;cd "+this.getHomePath() + "/bin;./startup.sh",this.getSession());
    }


}
